import java.util.PriorityQueue;

public class Demo2 {
    public boolean chkParenthesis(String A, int n) {
        PriorityQueue<Character> que = new PriorityQueue<>();
        if(n % 2 != 0) {
            return false;
        }


        for (int i = 0; i < A.length(); i++) {
            if(A.charAt(i) == '(') {
                que.offer(A.charAt(i));
            }else {
                if(A.charAt(i) == ')') {
                    que.poll();
                }else {
                    return false;
                }
            }
        }
        return que.isEmpty();
    }

    public static void main(String[] args) {
        int[] array = new int[10];
        for (int a : array) {
            break;
        }
    }
}
